package com.eati.cm.serv_impl;

import com.eati.cm.model.User;
import com.eati.cm.repo.UserRepo;
import com.eati.cm.serv.IUserServ;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServ implements IUserServ{
    @Autowired
    UserRepo userRepo;

    @Override
    public User findById(long id) {
    	userRepo.getOne(null);
        return userRepo.findById(id).get();
    }

    @Override
    public User findByName(String name){
        return userRepo.getOneByName(name);
    }

    @Override
    public void save(User u) {
        userRepo.save(u);
    }

    @Override
    public void flush(){
        userRepo.flush();
    }

    @Override
    public void delete(User u){
        userRepo.delete(u);
    }

}
